<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<script src="../vue.js"></script>

<body>
  <div id="app">
    <my-component id="test" class="test"> </my-component>
  </div>


  <script>
    // 注册组件
    Vue.component("my-component", {
      template: '<button @click="showAttrs">查看属性</button>',
      methods: {
        showAttrs() {


          console.log(this);
          console.log(vm);
          console.log(this.$attrs === vm.$attrs);

          // 无法获取class,style,props传值等属性
          console.log(this.$attrs);

        }
      }
    })

    var vm = new Vue({
      el: "#app",
    })
  </script>

</body>

</html>